﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using AspNetCs.Bll;
using AspNetCs.Common;
using AspNetCs.Enumerations.Channel_Enum;
using AspNetCs.Enumerations;

public partial class Agent_JiSiCenterManage : Admin_BasePage
{
    AncestralHallBLL bll = AncestralHall_Bll.CreatNew;
    protected void Page_Load(object sender, EventArgs e)
    {
        IsExitAgent();
        if (!IsPostBack)
        {
            if (!string.IsNullOrEmpty(Request["ClassId"]))
            {
                dataBind(StringHelper.isNumber_int(Request["ClassId"]));
                ViewState["ClassId"] = Request["ClassId"];
            }
            else
            {
                ResultStr("Default.aspx", "参数错误!");
            }
        }

    }


    public string getChannelName(int ChannelId)
    {
        EnumDescription[] Ed = EnumDescription.GetFieldTexts(typeof(Channel_Type), EnumDescription.SortType.Rank);
        foreach(EnumDescription en in Ed)
        {
            if(ChannelId==en.EnumValue)
            {
                return en.EnumDisplayText;
            }

        }
        return "";
    }


    protected void dataBind(int ClassId)
    {
        string cmdText = "select ji.id,ji.TrueName,ji.Message,ji.PublishTime,up.Types,CreateName=(select UserName from Users where Userid=ji.CreateId) from dbo.JisiMessage as ji inner join UserPhoto as up on ji.PhotoId=up.ID  inner join UserPhoto_class as uc on up.ClassID=uc.Id where uc.Id={0} order by ji.id desc";
        cmdText = string.Format(cmdText, ClassId);
        AspNetCs.Common.DataPagesOperate operate = new DataPagesOperate();

        operate.BindRepeater(cmdText, AspNetPager1, "ji.id desc", "id", rptNetMuList);


    }


    protected void AspNetPager1_PageChanged(object sender, EventArgs e)
    {
        dataBind(StringHelper.isNumber_int(ViewState["ClassId"].ToString()));
    }
}
